<?php 
$page_title='View Files';
include './includes/header.html';

require_once 'mysql_connect.php';

$first=TRUE;

$query="select upload_id,file_name,round(file_size/1024) as fs,description,date_format(date_entered,'%M %e,%Y')
 as d from uploads order by date_entered DESC";
$result=mysql_query($query);

while ($row=mysql_fetch_array($result)){
	//if first record create the header
	if ($first){
		echo '<table border="0" width="100%" cellspacing="3" cellpadding="3" align="center" >
		<tr>
			<td align="left" width="20%"><font size="+1">File Name</font></td>
			<td align="left" width="40%"><font size="+1">Description</font></td>
			<td align="center" width="20%"><font size="+1">File Size</font></td>
			<td align="left" width="20%"><font size="+1">Upload Date</font></td>
		</tr>';
		$first=FALSE;
	}
	
	echo "<tr>
	<td align=\"left\"><a href=\"download_file.php?uid={$row['upload_id']}\">{$row['file_name']}</a></td>
	<td align=\"left\">".stripslashes($row['description'])."</td>
	<td align=\"center\">{$row['fs']}kb</td>
	<td align=\"left\">{$row['d']}</td>
	</tr>\n";
}//end while

//if no records were displayed
if ($first){
	echo '<div align="center">There are currently bo files</div>';
}else {
	echo '</table>';
}
mysql_close();
include './includes/footer.html';
?>





